<template>
  <div :class="{ 'rcdg-card': true, 'is-shadow': shadow }" :style="radius ? { 'border-radius': radius } : {}">
    <div v-if="$slots.title || title" class="rcdg-card-head">
      <slot name="title">
        <div class="rcdg-card-head-title">{{ title }}</div>
      </slot>
    </div>
    <div class="rcdg-card-content">
      <slot></slot>
    </div>
    <div v-if="$slots.foot" class="rcdg-card-foot">
      <slot name="foot"></slot>
    </div>
  </div>
</template>
<script>
export default {
  name: 'RcdgCard',
  props: {
    title: {
      type: String,
      default: '',
    },
    shadow: {
      type: Boolean,
      default: true,
    },
    radius: {
      type: String,
      default: '4px',
    },
  },
}
</script>
<style lang="scss" scoped>
.rcdg-card {
  padding: 10px;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  &.is-shadow {
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  }
  &-head {
    display: flex;
    align-items: flex-end;
    margin-bottom: 0.16rem;
    line-height: 1.5;
    &-title {
      color: #333333;
      font-size: 0.16rem;
      font-weight: bolder;
    }
  }
  &-content {
    padding: 10px;
    flex: 1;
  }
}
</style>
